<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: BCD类 参考</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public 类型</a> &#124;
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="../../d5/d6e/class_b_c_d-members.html">所有成员列表</a>  </div>
  <div class="headertitle"><div class="title">BCD类 参考</div></div>
</div><!--header-->
<div class="contents">

<p>BCD编解码模块。这个模块的BCD编码是8421码  
 <a href="#details">更多...</a></p>

<p><code>#include &lt;<a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a>&gt;</code></p>
<div class="dynheader">
BCD 的协作图:</div>
<div class="dyncontent">
<div class="center"><img src="../../d7/d1c/class_b_c_d__coll__graph.png" border="0" usemap="#a_b_c_d_coll__map" alt="Collaboration graph"/></div>
<map name="a_b_c_d_coll__map" id="a_b_c_d_coll__map">
<area shape="rect" title="BCD编解码模块。这个模块的BCD编码是8421码" alt="" coords="5,5,201,411"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-types" name="pub-types"></a>
Public 类型</h2></td></tr>
<tr class="memitem:acce912bc8be5af4d17a2711e44f91ea3" id="r_acce912bc8be5af4d17a2711e44f91ea3"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acce912bc8be5af4d17a2711e44f91ea3">emErrCode</a> { <a class="el" href="#acce912bc8be5af4d17a2711e44f91ea3ac97d3d5bf6031a36aaf0695c36956ad7">ERR_ALLOC_MEM</a> = -1000
, <a class="el" href="#acce912bc8be5af4d17a2711e44f91ea3ad1473b8fb33aef936615e4386390be21">OK</a> = 0
 }</td></tr>
<tr class="separator:acce912bc8be5af4d17a2711e44f91ea3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a3d44b73ea05ac6ff8fe78ca08a1e78e6" id="r_a3d44b73ea05ac6ff8fe78ca08a1e78e6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3d44b73ea05ac6ff8fe78ca08a1e78e6">BCD</a> ()</td></tr>
<tr class="separator:a3d44b73ea05ac6ff8fe78ca08a1e78e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a987a5ca68ac10053480a89ae72cd1657" id="r_a987a5ca68ac10053480a89ae72cd1657"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a987a5ca68ac10053480a89ae72cd1657">BCD</a> (const uint8_t *data, size_t len, bool packed=true)</td></tr>
<tr class="memdesc:a987a5ca68ac10053480a89ae72cd1657"><td class="mdescLeft">&#160;</td><td class="mdescRight">直接读取BCD码  <br /></td></tr>
<tr class="separator:a987a5ca68ac10053480a89ae72cd1657"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56afb9005a606150e1972623250cb51e" id="r_a56afb9005a606150e1972623250cb51e"><td class="memTemplParams" colspan="2">template&lt;typename T , typename realT  = typename std::conditional&lt;  std::is_integral&lt;T&gt;::value &amp;&amp; !is_bool&lt; T &gt;::value , T , void &gt;::type&gt; </td></tr>
<tr class="memitem:a56afb9005a606150e1972623250cb51e"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#a56afb9005a606150e1972623250cb51e">BCD</a> (const realT &amp;value)</td></tr>
<tr class="memdesc:a56afb9005a606150e1972623250cb51e"><td class="mdescLeft">&#160;</td><td class="mdescRight">从整数转换成压缩的8421 BCD码  <br /></td></tr>
<tr class="separator:a56afb9005a606150e1972623250cb51e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acda67529c4b179b6bd26e6d7b2fa6c34" id="r_acda67529c4b179b6bd26e6d7b2fa6c34"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#acda67529c4b179b6bd26e6d7b2fa6c34">set</a> (uint8_t *data, size_t len, bool packed=true)</td></tr>
<tr class="memdesc:acda67529c4b179b6bd26e6d7b2fa6c34"><td class="mdescLeft">&#160;</td><td class="mdescRight">指定BCD码数据  <br /></td></tr>
<tr class="separator:acda67529c4b179b6bd26e6d7b2fa6c34"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ec02ba286418b4f14a254d407c9a970" id="r_a2ec02ba286418b4f14a254d407c9a970"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2ec02ba286418b4f14a254d407c9a970">fromString</a> (const std::string &amp;str, int base=10)</td></tr>
<tr class="memdesc:a2ec02ba286418b4f14a254d407c9a970"><td class="mdescLeft">&#160;</td><td class="mdescRight">从字符串转换到BCD码，这个字符串可以是常见的进制的内容，主要包括了8, 10, 16  <br /></td></tr>
<tr class="separator:a2ec02ba286418b4f14a254d407c9a970"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace1d86e0828ade4003cd61ff32e94649" id="r_ace1d86e0828ade4003cd61ff32e94649"><td class="memTemplParams" colspan="2">template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value &amp;&amp; !is_bool&lt;T&gt;::value, T , void &gt;::type&gt; </td></tr>
<tr class="memitem:ace1d86e0828ade4003cd61ff32e94649"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#ace1d86e0828ade4003cd61ff32e94649">fromUInt</a> (const realT &amp;data)</td></tr>
<tr class="memdesc:ace1d86e0828ade4003cd61ff32e94649"><td class="mdescLeft">&#160;</td><td class="mdescRight">从整数转换成BCD内容  <br /></td></tr>
<tr class="separator:ace1d86e0828ade4003cd61ff32e94649"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaefc1b6f071f558f0965572864538a5e" id="r_aaefc1b6f071f558f0965572864538a5e"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aaefc1b6f071f558f0965572864538a5e">toString</a> ()</td></tr>
<tr class="memdesc:aaefc1b6f071f558f0965572864538a5e"><td class="mdescLeft">&#160;</td><td class="mdescRight">将BCD码转换成字符串。  <br /></td></tr>
<tr class="separator:aaefc1b6f071f558f0965572864538a5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4cb413e79a5c07db4e124b30167db60" id="r_aa4cb413e79a5c07db4e124b30167db60"><td class="memTemplParams" colspan="2">template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value &amp;&amp; std::is_unsigned&lt;T&gt;::value, T , void &gt;::type&gt; </td></tr>
<tr class="memitem:aa4cb413e79a5c07db4e124b30167db60"><td class="memTemplItemLeft" align="right" valign="top">realT&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#aa4cb413e79a5c07db4e124b30167db60">toUInt</a> (realT *data=nullptr)</td></tr>
<tr class="memdesc:aa4cb413e79a5c07db4e124b30167db60"><td class="mdescLeft">&#160;</td><td class="mdescRight">从BCD码转换成无符号整数  <br /></td></tr>
<tr class="separator:aa4cb413e79a5c07db4e124b30167db60"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac2c055f384affd1279fd71202883c2a9" id="r_ac2c055f384affd1279fd71202883c2a9"><td class="memTemplParams" colspan="2">template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value ,typename std::make_signed&lt;T&gt;::type, void &gt;::type&gt; </td></tr>
<tr class="memitem:ac2c055f384affd1279fd71202883c2a9"><td class="memTemplItemLeft" align="right" valign="top">realT&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="#ac2c055f384affd1279fd71202883c2a9">toInt</a> (realT *data=nullptr)</td></tr>
<tr class="memdesc:ac2c055f384affd1279fd71202883c2a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">将bcd码转换成有符号的整数  <br /></td></tr>
<tr class="separator:ac2c055f384affd1279fd71202883c2a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bfc6281e30abf455b83759cf781ca13" id="r_a8bfc6281e30abf455b83759cf781ca13"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; uint8_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8bfc6281e30abf455b83759cf781ca13">get</a> ()</td></tr>
<tr class="memdesc:a8bfc6281e30abf455b83759cf781ca13"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取BCD数据内容。从内容中进行深拷贝并分配新的内存，使用std::shared_ptr管理，使用后可以自动释放内存  <br /></td></tr>
<tr class="separator:a8bfc6281e30abf455b83759cf781ca13"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>BCD编解码模块。这个模块的BCD编码是8421码 </p>
<dl class="section version"><dt>版本</dt><dd>1.0 </dd></dl>
<dl class="section author"><dt>作者</dt><dd>宋炜 </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2022-2-21 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00020">20</a> 行定义.</p>
</div><h2 class="groupheader">成员枚举类型说明</h2>
<a id="acce912bc8be5af4d17a2711e44f91ea3" name="acce912bc8be5af4d17a2711e44f91ea3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acce912bc8be5af4d17a2711e44f91ea3">&#9670;&#160;</a></span>emErrCode</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="#acce912bc8be5af4d17a2711e44f91ea3">BCD::emErrCode</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">枚举值</th></tr><tr><td class="fieldname"><a id="acce912bc8be5af4d17a2711e44f91ea3ac97d3d5bf6031a36aaf0695c36956ad7" name="acce912bc8be5af4d17a2711e44f91ea3ac97d3d5bf6031a36aaf0695c36956ad7"></a>ERR_ALLOC_MEM&#160;</td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="acce912bc8be5af4d17a2711e44f91ea3ad1473b8fb33aef936615e4386390be21" name="acce912bc8be5af4d17a2711e44f91ea3ad1473b8fb33aef936615e4386390be21"></a>OK&#160;</td><td class="fielddoc"></td></tr>
</table>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00023">23</a> 行定义.</p>

</div>
</div>
<h2 class="groupheader">构造及析构函数说明</h2>
<a id="a3d44b73ea05ac6ff8fe78ca08a1e78e6" name="a3d44b73ea05ac6ff8fe78ca08a1e78e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d44b73ea05ac6ff8fe78ca08a1e78e6">&#9670;&#160;</a></span>BCD() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">BCD::BCD </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00031">31</a> 行定义.</p>

</div>
</div>
<a id="a987a5ca68ac10053480a89ae72cd1657" name="a987a5ca68ac10053480a89ae72cd1657"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a987a5ca68ac10053480a89ae72cd1657">&#9670;&#160;</a></span>BCD() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">BCD::BCD </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *</td>          <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t</td>          <td class="paramname"><span class="paramname"><em>len</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>packed</em></span><span class="paramdefsep"> = </span><span class="paramdefval">true</span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>直接读取BCD码 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">data[</td><td>I ], </td></tr>
    <tr><td class="paramname">packed[</td><td>I ], 是否是压缩编码。true压缩编码，false非压缩编码 </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00037">37</a> 行定义.</p>

</div>
</div>
<a id="a56afb9005a606150e1972623250cb51e" name="a56afb9005a606150e1972623250cb51e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a56afb9005a606150e1972623250cb51e">&#9670;&#160;</a></span>BCD() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename realT  = typename std::conditional&lt;  std::is_integral&lt;T&gt;::value &amp;&amp; !is_bool&lt; T &gt;::value , T , void &gt;::type&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">BCD::BCD </td>
          <td>(</td>
          <td class="paramtype">const realT &amp;</td>          <td class="paramname"><span class="paramname"><em>value</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从整数转换成压缩的8421 BCD码 </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">realT</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">value[</td><td>I ] </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00049">49</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../de/d8d/class_b_c_d_a56afb9005a606150e1972623250cb51e_cgraph.png" border="0" usemap="#ade/d8d/class_b_c_d_a56afb9005a606150e1972623250cb51e_cgraph" alt=""/></div>
<map name="ade/d8d/class_b_c_d_a56afb9005a606150e1972623250cb51e_cgraph" id="ade/d8d/class_b_c_d_a56afb9005a606150e1972623250cb51e_cgraph">
<area shape="rect" title="从整数转换成压缩的8421 BCD码" alt="" coords="5,5,93,32"/>
<area shape="rect" href="../../de/d8d/class_b_c_d.html#ace1d86e0828ade4003cd61ff32e94649" title="从整数转换成BCD内容" alt="" coords="141,5,250,32"/>
<area shape="poly" title=" " alt="" coords="93,16,125,16,125,21,93,21"/>
</map>
</div>

</div>
</div>
<h2 class="groupheader">成员函数说明</h2>
<a id="a2ec02ba286418b4f14a254d407c9a970" name="a2ec02ba286418b4f14a254d407c9a970"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2ec02ba286418b4f14a254d407c9a970">&#9670;&#160;</a></span>fromString()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void BCD::fromString </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;</td>          <td class="paramname"><span class="paramname"><em>str</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int</td>          <td class="paramname"><span class="paramname"><em>base</em></span><span class="paramdefsep"> = </span><span class="paramdefval">10</span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从字符串转换到BCD码，这个字符串可以是常见的进制的内容，主要包括了8, 10, 16 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">str[</td><td>I ], 要转换的字符串 </td></tr>
    <tr><td class="paramname">base[</td><td>I ], 进制类型 </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00068">68</a> 行定义.</p>
<div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="../../de/d8d/class_b_c_d_a2ec02ba286418b4f14a254d407c9a970_cgraph.png" border="0" usemap="#ade/d8d/class_b_c_d_a2ec02ba286418b4f14a254d407c9a970_cgraph" alt=""/></div>
<map name="ade/d8d/class_b_c_d_a2ec02ba286418b4f14a254d407c9a970_cgraph" id="ade/d8d/class_b_c_d_a2ec02ba286418b4f14a254d407c9a970_cgraph">
<area shape="rect" title="从字符串转换到BCD码，这个字符串可以是常见的进制的内容，主要包括了8, 10, 16" alt="" coords="5,5,124,32"/>
<area shape="rect" href="../../de/d8d/class_b_c_d.html#ace1d86e0828ade4003cd61ff32e94649" title="从整数转换成BCD内容" alt="" coords="172,5,281,32"/>
<area shape="poly" title=" " alt="" coords="124,16,156,16,156,21,124,21"/>
</map>
</div>

</div>
</div>
<a id="ace1d86e0828ade4003cd61ff32e94649" name="ace1d86e0828ade4003cd61ff32e94649"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace1d86e0828ade4003cd61ff32e94649">&#9670;&#160;</a></span>fromUInt()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value &amp;&amp; !is_bool&lt;T&gt;::value, T , void &gt;::type&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void BCD::fromUInt </td>
          <td>(</td>
          <td class="paramtype">const realT &amp;</td>          <td class="paramname"><span class="paramname"><em>data</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从整数转换成BCD内容 </p>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00099">99</a> 行定义.</p>
<div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="../../de/d8d/class_b_c_d_ace1d86e0828ade4003cd61ff32e94649_icgraph.png" border="0" usemap="#ade/d8d/class_b_c_d_ace1d86e0828ade4003cd61ff32e94649_icgraph" alt=""/></div>
<map name="ade/d8d/class_b_c_d_ace1d86e0828ade4003cd61ff32e94649_icgraph" id="ade/d8d/class_b_c_d_ace1d86e0828ade4003cd61ff32e94649_icgraph">
<area shape="rect" title="从整数转换成BCD内容" alt="" coords="172,31,281,57"/>
<area shape="rect" href="../../de/d8d/class_b_c_d.html#a56afb9005a606150e1972623250cb51e" title="从整数转换成压缩的8421 BCD码" alt="" coords="21,5,108,32"/>
<area shape="poly" title=" " alt="" coords="156,36,108,28,109,23,157,30"/>
<area shape="rect" href="../../de/d8d/class_b_c_d.html#a2ec02ba286418b4f14a254d407c9a970" title="从字符串转换到BCD码，这个字符串可以是常见的进制的内容，主要包括了8, 10, 16" alt="" coords="5,56,124,83"/>
<area shape="poly" title=" " alt="" coords="157,58,124,63,124,57,156,52"/>
</map>
</div>

</div>
</div>
<a id="a8bfc6281e30abf455b83759cf781ca13" name="a8bfc6281e30abf455b83759cf781ca13"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8bfc6281e30abf455b83759cf781ca13">&#9670;&#160;</a></span>get()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt; uint8_t &gt; BCD::get </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取BCD数据内容。从内容中进行深拷贝并分配新的内存，使用std::shared_ptr管理，使用后可以自动释放内存 </p>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00210">210</a> 行定义.</p>

</div>
</div>
<a id="acda67529c4b179b6bd26e6d7b2fa6c34" name="acda67529c4b179b6bd26e6d7b2fa6c34"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acda67529c4b179b6bd26e6d7b2fa6c34">&#9670;&#160;</a></span>set()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void BCD::set </td>
          <td>(</td>
          <td class="paramtype">uint8_t *</td>          <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t</td>          <td class="paramname"><span class="paramname"><em>len</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool</td>          <td class="paramname"><span class="paramname"><em>packed</em></span><span class="paramdefsep"> = </span><span class="paramdefval">true</span>&#160;)</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>指定BCD码数据 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">data[</td><td>I ] ， </td></tr>
    <tr><td class="paramname">len[</td><td>I ] </td></tr>
    <tr><td class="paramname">packed[</td><td>I ] </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00058">58</a> 行定义.</p>

</div>
</div>
<a id="ac2c055f384affd1279fd71202883c2a9" name="ac2c055f384affd1279fd71202883c2a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2c055f384affd1279fd71202883c2a9">&#9670;&#160;</a></span>toInt()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value ,typename std::make_signed&lt;T&gt;::type, void &gt;::type&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">realT BCD::toInt </td>
          <td>(</td>
          <td class="paramtype">realT *</td>          <td class="paramname"><span class="paramname"><em>data</em></span><span class="paramdefsep"> = </span><span class="paramdefval">nullptr</span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将bcd码转换成有符号的整数 </p>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00180">180</a> 行定义.</p>

</div>
</div>
<a id="aaefc1b6f071f558f0965572864538a5e" name="aaefc1b6f071f558f0965572864538a5e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaefc1b6f071f558f0965572864538a5e">&#9670;&#160;</a></span>toString()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string BCD::toString </td>
          <td>(</td>
          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>将BCD码转换成字符串。 </p>
<dl class="section return"><dt>返回</dt><dd>返回10进制数字描述的字符串 </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00139">139</a> 行定义.</p>

</div>
</div>
<a id="aa4cb413e79a5c07db4e124b30167db60" name="aa4cb413e79a5c07db4e124b30167db60"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa4cb413e79a5c07db4e124b30167db60">&#9670;&#160;</a></span>toUInt()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T , typename realT  = typename std::conditional&lt; std::is_integral&lt;T&gt;::value &amp;&amp; std::is_unsigned&lt;T&gt;::value, T , void &gt;::type&gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">realT BCD::toUInt </td>
          <td>(</td>
          <td class="paramtype">realT *</td>          <td class="paramname"><span class="paramname"><em>data</em></span><span class="paramdefsep"> = </span><span class="paramdefval">nullptr</span></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>从BCD码转换成无符号整数 </p>
<dl class="tparams"><dt>模板参数</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">T</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">rst[</td><td>O ] </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>操作成功返回true，否则返回false </dd></dl>

<p class="definition">在文件 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a> 第 <a class="el" href="../../d6/d1f/bcd_8hpp_source.html#l00153">153</a> 行定义.</p>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>include/<a class="el" href="../../d6/d1f/bcd_8hpp_source.html">bcd.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
